/**
 * form: 表单对象
 * rule: 规则对象
 */
export default {
	RuleValidation(form, rule) {
		let type = true;
		for (let key in form) {
			for (let k in rule) {
				if (key == k) {
					if (rule[k].required) {
						if (rule[k].type == String) {
							if (form[k] == "") {
								uni.showToast({
									title: rule[k].message,
									icon: 'none',
								});
								return type = false;
							};
						}
						if (rule[k].type == Array) {
							if (form[k].length <=0) {
								uni.showToast({
									title: rule[k].message,
									icon: 'none',
								});
								return type = false;
							};
						}
					};
				};
			};
		};
		return type
	}
}

// 示例
// let form = {
// 	paymentName: null,
// };
// let rule = {
//     paymentName: { type: "text"/** 数据类型 */, required: true/** 是否验证 */, message: "提示内容" },
// };
// RuleValidation(form, rule); // 返回结果 true 或者 false;
